#!/usr/bin/perl

if (@ARGV != 1)
{
	print "usage: $0 filename\n";
	exit 0;
}

my $table = {};
my $file = $ARGV[0];

open(FH, "< $file") or die "Couldn't open file[$file] for reading";
while(<FH>)
{
	next unless ($_ =~ /.*- (.*):(.*);(\d+);(\d+);(\d+)/);

	if (defined($table->{$1}->{$2}))
	{
		$table->{$1}->{$2}->{first} += $3;
		$table->{$1}->{$2}->{second} += $4;
		$table->{$1}->{$2}->{third} += $5;
	}
	else
	{
		$table->{$1}->{$2}->{first} = $3;
		$table->{$1}->{$2}->{second} = $4;
		$table->{$1}->{$2}->{third} = $5;
	}
}

while (($key, $value) = each(%$table) )
{
	while (($k, $v) = each(%$value) )
	{
		print "$key;$k;$v->{first},$v->{second},$v->{third}\n";
	}
}

exit 0;
